home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD004b.dsk
/
CENTURY.DATE.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
4KB
|
97 lines
5 REM *** CENTURY.DATE ***
6 TEXT : HOME
7 VTAB 4: HTAB 12: PRINT "CENTURY.DATE"
8 VTAB 12: PRINT "INITIALIZATION TAKES 7 SECONDS"
10 GOSUB 8000: GOTO 1000
100 Y4 = YY/N4:I4 = INT(Y4):CD = (YY *LY) +I4 +DD
110 IF I4 = Y4 AND MM <N3 THEN CD = CD -N1
120 CD = CD +VD(MM): RETURN
200 DW$ = VD$(CD -( INT(CD/N7) *N7)): RETURN
300 YY = INT(CD/LY):JD = CD -(YY *LY) - INT((YY -N1)/N4): IF JD <N1 THEN YY = YY -N1
310 LF = N0:Y4 = YY/N4: IF INT(Y4) = Y4 THEN LF = N1
320 IF JD <N1 AND LF = N0 THEN JD = LY +JD
330 IF JD <N1 AND LF = N1 THEN JD = LY +JD +N1
340 IF JD <SY THEN LF = N0
350 MM = VM(JD -LF):MM$ = MO$(MM):DD = JD -LF -VD(MM): IF JD = SY THEN DD = DD +LF
360 RETURN
400 GOSUB 200: GOSUB 300:FD$ = DW$ +" " + STR$(DD) +" " +MM$ +" " + STR$(YY): RETURN
1000 HOME : VTAB 3: HTAB 15
1010 PRINT "CENTURY.DATE"
1030 VTAB 8: PRINT " 1 = ABOUT CENTURY.DATES"
1035 VTAB 10: PRINT " 2 = MO-DA-YR TO CENTURY.DATE"
1040 VTAB 12: PRINT " 3 = MO-DA-YR TO DAY-OF-WEEK"
1050 VTAB 14: PRINT " 4 = MO-DA-YR TO FULL.DATE"
1060 VTAB 16: PRINT " 5 = CENTURY.DATE TO MO-DA-YR"
1070 VTAB 18: PRINT " 6 = QUIT"
1080 VTAB 22: CALL -868: HTAB 15: PRINT "WHICH? ";: GET R$
1090 IF R$ = "1" GOTO 2000
1092 IF R$ = "2" GOTO 3000
1094 IF R$ = "3" GOTO 4000
1096 IF R$ = "4" GOTO 5000
1098 IF R$ = "5" GOTO 6000
1100 IF R$ = "6" THEN HOME : END
1110 GOTO 1080
2000 HOME : VTAB 4: HTAB 12: PRINT "ABOUT CENTURY.DATES"
2010 VTAB 8: PRINT "THE TERM CENTURY.DATE REFERS TO THE"
2020 PRINT "DATE EXPRESSED AS THE NUMBER OF DAYS"
2030 PRINT "SINCE THE LAST DAY OF THE YEAR 1899.
2040 PRINT : PRINT
2050 PRINT "IF YOU WANT TO KNOW THE NUMBER OF DAYS"
2060 PRINT "BETWEEN TWO DATES YOU CAN CONVERT BOTH"
2070 PRINT "DATES TO CENTURY.DATES AND SUBTRACT THE"
2080 PRINT "SMALL ONE FROM THE LARGE ONE."
2090 GOSUB 10000
2100 GOTO 1000
3000 GOSUB 9000
3010 GOSUB 100
3020 HOME : VTAB 10
3030 YY = YY +1900
3040 PRINT "MO DA YEAR": PRINT
3050 PRINT MM;"-";DD;"-";YY;" = ";CD;" DAYS SINCE 1900"
3060 GOSUB 10000
3070 GOTO 1000
4000 GOSUB 9000
4010 GOSUB 100
4020 GOSUB 200
4030 HOME : VTAB 10
4040 YY = YY +1900
4050 PRINT "MO DA YEAR": PRINT
4060 PRINT MM;"-";DD;"-";YY;" = ";DW$
4070 GOSUB 10000
4080 GOTO 1000
5000 GOSUB 9000
5010 GOSUB 100: GOSUB 400
5020 HOME : VTAB 10
5030 YY = YY +1900
5040 PRINT "MO DA YEAR": PRINT
5050 PRINT MM;"-";DD;"-";YY;" = ";FD$
5060 GOSUB 10000
5070 GOTO 1000
6000 HOME : HTAB 12: PRINT "GET CENTURY.DATE"
6010 VTAB 12: CALL -868: INPUT "CENTURY.DATE (1-73049)? ";CD$
6020 CD = INT( VAL(CD$)): IF CD <1 OR CD >73049 GOTO 6010
6030 GOSUB 300
6040 HOME : VTAB 10
6050 YY = YY +1900
6060 PRINT "CENTURY.DATE OF ";CD;" = ";MM;"-";DD;"-";YY
6070 GOSUB 10000
6080 GOTO 1000
8000 DIM VD(13):VD(1) = 0:VD(2) = 31:VD(3) = 59:VD(4) = 90:VD(5) = 120:VD(6) = 151:VD(7) = 181:VD(8) = 212:VD(9) = 243:VD(10) = 273:VD(11) = 304:VD(12) = 334:VD(13) = 365
8010 DIM VM(366):J = 1
8020 FOR I = 1 TO 366
8030 IF I >VD(J +1) AND J <12 THEN J = J +1
8040 VM(I) = J: NEXT
8050 DIM MO$(12):MO$(1) = "JAN":MO$(2) = "FEB":MO$(3) = "MAR":MO$(4) = "APR":MO$(5) = "MAY":MO$(6) = "JUN":MO$(7) = "JUL":MO$(8) = "AUG":MO$(9) = "SEP":MO$(10) = "OCT":MO$(11) = "NOV":MO$(12) = "DEC"
8060 DIM VD$(6):VD$(0) = "SUN":VD$(1) = "MON":VD$(2) = "TUE":VD$(3) = "WED":VD$(4) = "THR":VD$(5) = "FRI":VD$(6) = "SAT"
8070 N0 = 0:N1 = 1:N3 = 3:N4 = 4:N7 = 7
8080 LY = 365:SY = 60
8090 RETURN
9000 HOME : HTAB 12: PRINT "GET MO-DA-YR"
9010 VTAB 6: CALL -868: INPUT "MONTH (1-12)? ";MM$
9020 MM = INT( VAL(MM$)): IF MM <1 OR MM >12 GOTO 9010
9030 VTAB 10: CALL -868: INPUT "DAY (1-31)? ";DD$
9040 DD = INT( VAL(DD$)): IF DD <1 OR DD >31 GOTO 9030
9050 VTAB 14: CALL -868: INPUT "YEAR (1900-2099)? ";YY$
9060 YY = INT( VAL(YY$)): IF YY <1900 OR YY >2099 GOTO 9050
9070 YY = YY -1900: RETURN
10000 VTAB 22: INPUT "*** HIT RETURN FOR MENU ";R$: RETURN